#include "ICollidable.h"
#include "CollisionManager.h"

namespace PeanutQuest {

	ICollidable::ICollidable() {
		CollisionManager* cm = (CollisionManager*)cg::Registry::instance()->get("CollisionManager");
		//cm = dynamic_cast<PeanutQuest::CollisionManager*>(cg::Registry::instance()->get("CollisionManager"));
		cm->add(this); 
		cm->init();
	}

	ICollidable::~ICollidable() {
		CollisionManager* cm = (CollisionManager*)cg::Registry::instance()->get("CollisionManager");
		if(cm) {
			cm->icollidable_vector.erase(std::remove(cm->icollidable_vector.begin(), cm->icollidable_vector.end(), this), cm->icollidable_vector.end());
		}
	}

	void ICollidable::setMyPosition(cg::Vector3d pos) {
		myPosition = pos;
	}

	cg::Vector3d ICollidable::getMyPosition()  {
		return myPosition;
	}

	float ICollidable::getRadius() {
		return _radius;
	}

	std::string ICollidable::getStatus() {
		return _status;
	}

	std::string ICollidable::getName() {
		return _name;
	}
}